package com.tanhua.server.controller;


import com.tanhua.model.vo.PageResult;
import com.tanhua.model.vo.SettingsVo;
import com.tanhua.model.vo.UserInfoVoAge;
import com.tanhua.server.service.SettingsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 通用设置管理控制层
 */


@RestController
@RequestMapping("/users")
public class SettingsController {

    /**
     * 用户通用设置 - 读取
     */
    @Autowired
    private SettingsService settingsService;
    @RequestMapping(value = "/settings",method = RequestMethod.GET)
    public ResponseEntity findSettings(){
        SettingsVo settingsVo = settingsService.findSettings();
        return ResponseEntity.ok(settingsVo);
    }

    /**
     * 黑名单 - 翻页列表
     */

    @RequestMapping(value = "/blacklist",method = RequestMethod.GET)
    public ResponseEntity findPageBlackList(
            @RequestParam(value = "page",defaultValue = "1")Long page,
            @RequestParam(value = "pagesize",defaultValue = "10")Long pagesize)
         {
             PageResult<UserInfoVoAge>  pageResult = settingsService.findPageBlackList(page,pagesize);
        return ResponseEntity.ok(pageResult);
    }
}
